package cn.imvc.app.models;

import java.util.Date;
import java.util.List;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;

import cn.imvc.app.entities.Voucher;
import cn.imvc.data.domain.ViewRequest;

public interface VoucherModel{
	Page<Voucher> find(ViewRequest viewRequest);

	Voucher get(int id);

	Voucher save(Voucher entity);

	Voucher update(Voucher entity);

	void delete(int id);

	void deleteBatch(int[] ids);
	/**
	 *  根据订单金额，检查该优惠券是否适用；若使用返回该优惠券对象 否则返回null
	 * @param orderAmount
	 * @param voucherId
	 * @return
	 */
	Voucher checkIsValid(int orderAmount, Integer voucherId);
	
	/**
	 * 
	 * 根据订单金额获取可用代金券
	 * @param memberId
	 * @param orderAmount
	 * @param state
	 * @param nowDate
	 * @return
	 */
	List<Voucher> getVouchersInfoByOrderAmount(Integer memberId, int orderAmount,byte state,Date nowDate) ;
	
	Page<Voucher> findByMemberId(Integer memberId,PageRequest pageRequest);
	
}